package com.supreme.securityserver.entity;

import com.supreme.commonentity.mysql.primary.SysUser;
import com.supreme.securityserver.security.AuthUser;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Set;

@NoArgsConstructor
@Data
public class LoginUser {

    private Long userId;

    private String username;

    private String userCode;

    private Set<String> permissions;

    /**
     * 登录时间
     */
    private Long loginTime;

    /**
     * 过期时间
     */
    private Long expireTime;

    /**
     * 登录IP地址
     */
    private String ipaddr;

    /**
     * 登录地点
     */
    private String loginLocation;

    /**
     * 浏览器类型
     */
    private String browser;

    /**
     * 操作系统
     */
    private String os;

    public LoginUser(SysUser sysUser) {
        this.userId = sysUser.getUserId();
        this.username = sysUser.getUsername();
        this.userCode = sysUser.getUserCode();
    }

    public LoginUser(AuthUser authUser) {
        this.userId = authUser.getUserId();
        this.username = authUser.getUsername();
        this.userCode = authUser.getUserCode();
    }
}
